package com.jimmy.medical.enums;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @Desc: 订单状态
 * 	
 * 		代码不连续，方便以后扩展
 *
 * @author jimmy

 * @date 2018-04-11
 */
public enum OrderStatusEnum {
	
	WAITTING_PROCESS(1, "待处理"),
	SIMPLE_PROCESS(20, "初步处理"),
	SIGNED(30, "已挂号"),
	SETTLE_ACCOUNTS(40, "已结算"),
	EXECUTED(50, "已执行"),
	APPROVED(60, "已审核"),
	FINISHED(70, "已完结"),
	CANCELED(80, "已取消"),
	WAIt_PAY(90,"待付款");
	
	private int key;	//代码
	private String text;	//名称
	
	OrderStatusEnum(int key, String text) {
		this.key = key;
		this.text = text;
	}

	/**
	 * 根据key获取名称
	 */
	public static String getTextByKey(int key) {
		for (OrderStatusEnum obj : OrderStatusEnum.values()) {
			if (obj.key == key) {
				return obj.text;
			}
		}
		return null;
	}
	
	/**
	 * 将枚举类型转换为Map
	 * @return
	 */
	public static Map<Integer, String> getMapValue() {
		Map<Integer, String> map = new LinkedHashMap<Integer, String>();
		for (OrderStatusEnum obj : OrderStatusEnum.values()) {
			map.put(obj.key, obj.text);
		}
		return map;
	}
	
	public int getKey() {
		return key;
	}

	public String getText() {
		return text;
	}
	
}
